package com.example.mobile2030606150cjk0427;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private Button btnMainss;
    private RecyclerView rvMainlr;
    private List<Parking> list = new ArrayList();



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        iniData();
        rvMainlr.setLayoutManager(new LinearLayoutManager(this));
        rvMainlr.setAdapter(new ParkingRVAdapter(list));
    }

    private void iniData() {
        list.add(new Parking(R.drawable.ph1, "佛山植物园-停车场", "空位：26", "价格：5元/小时", "距离：50公里", "地址：兴业西路\n17号", "更多信息"));
        list.add(new Parking(R.drawable.ph2,"乐从医院-停车场", "空位：26", "价格：5元/小时", "距离：50公里", "地址：广东省佛山市\n顺德区乐从医院", "更多信息"));
        list.add(new Parking(R.drawable.ph3,"南海观音寺-停车场", "空位：26", "价格：5元/小时", "距离：50公里", "地址：佛山市南海\\n区南国桃园", "更多信息"));
        list.add(new Parking(R.drawable.ph4,"大塘服务区-停车场", "空位：26", "价格：5元/小时", "距离：50公里", "地址：G94珠三角\n环线高速附近", "更多信息"));
        list.add(new Parking(R.drawable.ph5,"明湖公园-停车场", "空位：26", "价格：5元/小时", "距离：50公里", "地址：荷富路辅路\n东50米明湖公园", "更多信息"));
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tvMainTitle);
        btnMainss = (Button) findViewById(R.id.btnMainss);
        rvMainlr = (RecyclerView) findViewById(R.id.rvMainlr);
    }
}